<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j">
		<a4j:loadScript src="resource://jquery.js"></a4j:loadScript>
		<a4j:form id="BuyForm" styleClass="trn_form" ajaxSingle="true">
		<rich:jQuery selector="#j_id694:BuyForm:buyHeadStamping" timing="onload" query="focus()" />
			<a4j:outputPanel id="msgContainer" ajaxRendered="true">
				<h:messages globalOnly="false" errorClass="msgError" styleClass="message" infoClass="msgInfo" />
			</a4j:outputPanel>
			<a4j:outputPanel id="SaleHeadPanel">
				<div id="SaleHead">
				
				<div id="Form_Table">
					<div id="Form_Row">
						<div class="form_fields">
							<s:label for="saleHeadStamping">Timbrado:</s:label>
							<h:inputText
								styleClass="input"
								value="#{trnSale.salesHead.stamping}"
								id="saleHeadStamping" 
								size="10">
                    			<a4j:support event="onchange"></a4j:support>
                    			<rich:ajaxValidator 
                    			event="onblur" 
                    			onsubmit="validateStringField(
                    				fieldObject = this, 
                    				fieldMsgId = 'saleHeadStampingMsg', 
                    				required = 'true', 
                    				requiredMsg = 'Favor ingrese el Timbrado', 
                    				chekForLength = 'false', 
                    				min = 0, 
                    				max = 0)">
           						</rich:ajaxValidator>
							</h:inputText>
							<div id="saleHeadStampingMsg" class="inactiveMsg"></div>
						</div>
						<div class="form_fields">
							<s:label for="saleHeadEstablishment">Establecimiento:</s:label>
							<h:inputText
								styleClass="input required"
								value="#{trnSale.salesHead.establishment}"
								id="saleHeadEstablishment" 
								size="5"
								validatorMessage="El Establecimiento debe contener 3 caracteres">
								<a4j:support event="onchange"></a4j:support>
                    			<rich:ajaxValidator 
                    			event="onblur" 
                    			onsubmit="validateStringField(
                    				fieldObject = this, 
                    				fieldMsgId = 'saleHeadEstablishmentMsg', 
                    				required = 'true', 
                    				requiredMsg = 'Favor ingrese el Establecimiento', 
                    				chekForLength = 'false', 
                    				min = 0, 
                    				max = 0)">
           						</rich:ajaxValidator>
							</h:inputText>
							<div id="saleHeadEstablishmentMsg" class="inactiveMsg"></div>
						</div>
						<div class="form_fields">
							<s:label for="saleHeadExpedition">Punto Expedicion:</s:label>
							<h:inputText
								styleClass="input"
								value="#{trnSale.salesHead.expedition}"
								id="saleHeadExpedition" 
								size="5"
								validatorMessage="El Punto de expedicion debe contener 3 caracteres">
								<a4j:support event="onchange"></a4j:support>
								<rich:ajaxValidator 
                    			event="onblur" 
                    			onsubmit="validateStringField(
                    				fieldObject = this, 
                    				fieldMsgId = 'saleHeadExpeditionMsg', 
                    				required = 'true', 
                    				requiredMsg = 'Favor ingrese el Punto de Expedicion', 
                    				chekForLength = 'false', 
                    				min = 0, 
                    				max = 0)">
           						</rich:ajaxValidator>
							</h:inputText>
							<div id="saleHeadExpeditionMsg" class="inactiveMsg"></div>
						</div>
						<div class="form_fields">
							<s:label for="saleHeadVoucher">Nro. Factura:</s:label>
							<h:inputText
								styleClass="input"
								value="#{trnSale.salesHead.voucher}"
								id="saleHeadVoucher" size="10">
								<a4j:support event="onchange"></a4j:support>
								<rich:ajaxValidator 
                    			event="onblur" 
                    			onsubmit="validateStringField(
                    				fieldObject = this, 
                    				fieldMsgId = 'saleHeadVoucherMsg', 
                    				required = 'true', 
                    				requiredMsg = 'Favor ingrese el Nro. de Factura', 
                    				chekForLength = 'false', 
                    				min = 0, 
                    				max = 0)">
           						</rich:ajaxValidator>
							</h:inputText>
							<div id="saleHeadVoucherMsg" class="inactiveMsg"></div>
						</div>
					</div>
					<div id="Form_Row">
						<div class="form_fields">
							<s:label for="saleHeadVoucherData">Tipo de Comprobante:</s:label>
							<h:selectOneMenu 
								styleClass="input"
								value="#{trnSale.salesHead.voucherData}"
								id="saleHeadVoucherData" 
								converter="#{voucherConverter}">
								<a4j:support event="onchange" />
								<rich:ajaxValidator 
                    			event="onblur" 
                    			onsubmit="validateSelectField(
                    				fieldObject = this, 
                    				fieldMsgId = 'saleHeadVoucherDataMsg', 
                    				required = 'true', 
                    				requiredMsg = 'Favor seleccione el Tipo de Comprobante')">
           						</rich:ajaxValidator>
								<s:selectItems
									value="#{withinHolder.voucherListTransaction('SALE')}"
									var="voucher" label="#{voucher.descrip}"
									noSelectionLabel="Tipo de Comprobante">
								</s:selectItems>
	
							</h:selectOneMenu>
							<div id="saleHeadVoucherDataMsg" class="inactiveMsg"></div>
						</div>
						<div class="form_fields">
							<s:label for="saleHeadBuyType">Tipo de Venta:</s:label>
							<h:selectOneMenu
								styleClass="input"
								value="#{trnSale.salesHead.saleTypeData}"
								id="saleHeadBuyType" converter="#{refConverter}">
								<a4j:support event="onchange" />
								<rich:ajaxValidator 
                    			event="onblur" 
                    			onsubmit="validateSelectField(
                    				fieldObject = this, 
                    				fieldMsgId = 'saleHeadBuyTypeMsg', 
                    				required = 'true', 
                    				requiredMsg = 'Favor seleccione el tipo de compra')">
           						</rich:ajaxValidator>
								<s:selectItems
									value="#{withinHolder.refDetListByHeadCod('TIPCOMPRA')}"
									var="ref" label="#{ref.descrip}"
									noSelectionLabel="Tipo de Venta">
								</s:selectItems>
	
							</h:selectOneMenu>
							<div id="saleHeadBuyTypeMsg" class="inactiveMsg"></div>
						</div>
						
						<div class="form_fields">
							<s:label for="saleHeadCostCenter">Centro de Costo:</s:label>
							<h:selectOneMenu
								styleClass="input"
								value="#{trnSale.salesHead.costCenterData}"
								id="saleHeadCostCenter" 
								converter="#{refConverter}">
								<a4j:support event="onchange" />
								<rich:ajaxValidator 
                    			event="onblur" 
                    			onsubmit="validateSelectField(
                    				fieldObject = this, 
                    				fieldMsgId = 'saleHeadCostCenterMsg', 
                    				required = 'true', 
                    				requiredMsg = 'Favor seleccione el Centro de Costo')">
           						</rich:ajaxValidator>
								<s:selectItems
									value="#{withinHolder.refDetListByHeadCod('CENTCOST')}"
									var="ref" label="#{ref.descrip}"
									noSelectionLabel="Centro de Costo">
								</s:selectItems>
							</h:selectOneMenu>
							<div id="saleHeadCostCenterMsg" class="inactiveMsg"></div>
						</div>
					</div>
					<div id="Form_Row">
						<div class="form_fields">
							<s:label for="saleHeadCustomer">Cliente:</s:label>
							<h:inputText
								readonly="true"
								styleClass="input"
								value="#{trnSale.salesHead.customerData}"
								id="saleHeadCustomer"
								converter="#{customerConverter}">
								<a4j:support event="onchange" reRender="saleHeadOrderPanel" />
								<rich:ajaxValidator 
                    			event="onblur" 
                    			onsubmit="validateStringField(
                    				fieldObject = this, 
                    				fieldMsgId = 'saleHeadCustomerMsg', 
                    				required = 'true', 
                    				requiredMsg = 'Favor seleccione el proveedor')">
           						</rich:ajaxValidator>
							</h:inputText>
							<a4j:commandLink
							id="selectSaleCustomer"
							action="#{trnSale.selectHolder.customerPickList()}"
							oncomplete="#{rich:component('customerPickModalPanel')}.show()"
							ajaxSingle="true"
							reRender="saleCustomerListForm">
								<h:graphicImage value="/img/icons/table_multiple.png" />
							</a4j:commandLink>
							<rich:toolTip for="selectSaleCustomer" value="Seleccionar Proveedor"></rich:toolTip>
							<div id="saleHeadCustomerMsg" class="inactiveMsg"></div>
						</div>
						<div class="form_fields">
							<s:label for="saleHeadCurrency">Moneda:</s:label>
							<h:selectOneMenu
								styleClass="input"
								converter="#{currencyConverter}"
								value="#{trnSale.salesHead.currencyData}"
								id="saleHeadCurrency">
								<a4j:support event="onchange"
									actionListener="#{trnSale.retrieveChangeType()}"
									reRender="saleHeadChangeTypePanel"
									ajaxSingle="true" />
								<rich:ajaxValidator 
                    			event="onblur" 
                    			onsubmit="validateSelectField(
                    				fieldObject = this, 
                    				fieldMsgId = 'saleHeadCurrencyMsg', 
                    				required = 'true', 
                    				requiredMsg = 'Favor seleccione la moneda')">
           						</rich:ajaxValidator>
								<s:selectItems 
									value="#{withinHolder.currencyList()}" 
									var="cur"
									label="#{cur.descrip}" 
									noSelectionLabel="Seleccione la Moneda">
								</s:selectItems>
							</h:selectOneMenu>
							<div id="saleHeadCurrencyMsg" class="inactiveMsg"></div>
						</div>
						<a4j:outputPanel id="saleHeadChangeTypePanel">
							<div class="form_fields">
								<s:label for="saleHeadChangeType">Tipo de Cambio:</s:label>
								<h:inputText
									styleClass="input"
									value="#{trnSale.salesHead.changeType}"
									id="saleHeadChangeType" 
									size="10" 
									disabled="true">
									<a4j:support event="onchange" />
									<a4j:support event="onblur"></a4j:support>
								</h:inputText>
								<div id="saleHeadChangeTypeMsg" class="inactiveMsg"></div>
							</div>
						</a4j:outputPanel>
					</div>
					<div id="Form_Row">
						<div class="form_fields">
							<s:label for="saleHeadVoucherDate">Fecha Factura:</s:label>
							<rich:calendar 
								inputClass="input"
								id="saleHeadVoucherDate"
								value="#{trnSale.salesHead.voucherDate}" 
								datePattern="dd/M/yyyy hh:mm:a"
								buttonClass="field_btn">
								<a4j:support event="oninputchange"></a4j:support>
								<rich:ajaxValidator 
                    			event="oninputblur" 
                    			onsubmit="validateDateField(
                    				fieldObject = this, 
                    				fieldMsgId = 'saleHeadVoucherDateMsg', 
                    				required = 'true', 
                    				requiredMsg = 'Favor ingrese la fecha de factura',
                    				beforeToday = 'false', 
                    				afterToday = 'false', 
                    				inMonth = 'true')">
           						</rich:ajaxValidator>
           						<rich:ajaxValidator 
                    			event="onchanged" 
                    			onsubmit="validateDateField(
                    				fieldObject = this, 
                    				fieldMsgId = 'saleHeadVoucherDateMsg', 
                    				required = 'true', 
                    				requiredMsg = 'Favor ingrese la fecha de factura',
                    				beforeToday = 'false', 
                    				afterToday = 'false', 
                    				inMonth = 'true')">
           						</rich:ajaxValidator>
							</rich:calendar>
							<div id="saleHeadVoucherDateMsg" class="inactiveMsg"></div>	
						</div>
					</div>
				</div>
			</div>
			</a4j:outputPanel>
			
			<a4j:region id="SaleDetForm">
				<a4j:outputPanel id="DetGridPanel">	
				<rich:datascroller align="center" for="SaleDetGrid"
						maxPages="15" page="#{dataTableScrollerBean.scrollerPage}"
						renderIfSinglePage="false" />			   			
				<div style="clear: both;" />
				<rich:panel styleClass="table_add" style="margin-top:10px;" rendered="true">
					<rich:dataTable id="SaleDetGrid" value="#{trnSale.allSalesDet}" var="row">
						<f:facet name="header">
							<rich:columnGroup>
								<rich:column rowspan="2">
									<h:selectBooleanCheckbox 
										id="selectAllSaleDet" 
										value="#{trnSale.selectedAll}" 
										onclick="this.blur()"
										disabled="#{empty trnSale.allSalesDet}">
							        	<a4j:support event="onchange" actionListener="#{trnSale.selectAll}" reRender="SaleDetGrid"/>
							      	</h:selectBooleanCheckbox>
							      	<rich:toolTip for="selectAllSaleDet" value="Seleccionar Todo"></rich:toolTip>
							      	<a4j:commandLink
							      		rendered="#{not empty trnSale.allSalesDet}"
							      		id="deleteSelectedSaleDet"
										action="#{trnSale.deleteSelected()}"
										reRender="DetGridPanel, SaleDetGrid">
										<h:graphicImage value="/img/icons/table_delete.png" />
									</a4j:commandLink>
									<rich:toolTip for="deleteSelectedSaleDet" value="Eliminar Seleccionados"></rich:toolTip>
								</rich:column>
								<rich:column>
									<h:outputText value="Insumo" />
								</rich:column>
								<rich:column>
									<h:outputText value="Unidad de Medida" />
								</rich:column>
								<rich:column>
									<h:outputText value="I.V.A." />
								</rich:column>
								<rich:column>
									<h:outputText value="Cantidad" />
								</rich:column>
								<rich:column>
									<h:outputText value="Costo" />
								</rich:column>
								<rich:column>
									<h:outputText value="Descuento" />
								</rich:column>
								<rich:column>
									<h:outputText value="Recargo" />
								</rich:column>
								<rich:column rowspan="2">
									<a4j:commandButton 
										id="saleInsDetailBtn" 
										action="#{trnSale.insertDetail()}"
										value="Insertar" 
										reRender="DetGridPanel" 
										onclick="onRequestStart();"
										oncomplete="onRequestEnd();"/>
								</rich:column>
							
								<rich:column breakBefore="true">
									<h:selectOneMenu converter="#{suppliesConverter}"
										value="#{trnSale.salesDet.supplyData}" 
										id="saleDetSupply" >
										<a4j:support event="onchange" actionListener="#{trnSale.retrieveSupplyData()}" reRender="taxPanel, saleDetCostPanel"/>
										<rich:ajaxValidator 
		                    			event="onblur"
		                    			onsubmit="validateSelectField(
		                    				fieldObject = this, 
		                    				fieldMsgId = 'saleDetSupplyMsg', 
		                    				required = 'true', 
		                    				requiredMsg = 'Favor seleccione el insumo',
		                    				errorClass = 'msgErrorDet',
		                    				errorInput = 'inputErrorDet')">
		           						</rich:ajaxValidator>
										<s:selectItems id="SuplySelect"
											value="#{withinHolder.suppliesList()}" var="supp"
											label="#{supp.descrip}" noSelectionLabel="Insumo">
										</s:selectItems>
									</h:selectOneMenu>
									<div id="saleDetSupplyMsg" class="inactiveMsg"></div>
								</rich:column>
								<rich:column>
									<h:selectOneMenu converter="#{MeasureUnitConverter}"
										value="#{trnSale.salesDet.measureUnitData}"
										id="saleDetMeasureUnit" required="false"
										requiredMessage="Favor Seleccione la Unidad de Medida">
										<a4j:support event="onchange" reRender="saleDetCostPanel"></a4j:support>
										<rich:ajaxValidator 
		                    			event="onblur"
		                    			onsubmit="validateSelectField(
		                    				fieldObject = this, 
		                    				fieldMsgId = 'saleDetMeasureUnitMsg', 
		                    				required = 'true', 
		                    				requiredMsg = 'Favor seleccione la UM',
		                    				errorClass = 'msgErrorDet',
		                    				errorInput = 'inputErrorDet')">
		           						</rich:ajaxValidator>
										<s:selectItems value="#{withinHolder.measureUnitList()}"
											var="cur" label="#{cur.descrip}" noSelectionLabel="">
										</s:selectItems>
									</h:selectOneMenu>
									<div id="saleDetMeasureUnitMsg" class="inactiveMsg"></div>
								</rich:column>
								
								<rich:column>
									<a4j:outputPanel id="taxPanel" >
									<h:selectOneMenu converter="#{taxConverter}"
										value="#{trnSale.salesDet.taxData}" id="saleDetIva"
										disabled="true">
										<s:selectItems value="#{withinHolder.taxesList()}" var="cur"
											label="#{cur.descrip}">
										</s:selectItems>
									</h:selectOneMenu>
									</a4j:outputPanel>
								</rich:column>
								
								<rich:column>
									<h:inputText value="#{trnSale.salesDet.quantity}"
										id="saleDetQuantity"  
										size="10">
										<a4j:support event="onchange"></a4j:support>
										<rich:ajaxValidator 
		                    			event="onblur"
		                    			onsubmit="validateDecimalField(
		                    				fieldObject = this, 
		                    				fieldMsgId = 'saleDetQuantityMsg', 
		                    				required = 'true', 
		                    				requiredMsg = 'Favor ingrese la cantidad',
		                    				checkForZero = 'true',
		                    				errorClass = 'msgErrorDet',
		                    				errorInput = 'inputErrorDet')">
		           						</rich:ajaxValidator>
									</h:inputText>
									<div id="saleDetQuantityMsg" class="inactiveMsg"></div>
								</rich:column>
								<rich:column>
									<a4j:outputPanel id="saleDetPricePanel" >
									<h:inputText value="#{trnSale.salesDet.basicPrice}"
										id="saleDetPrice" 
										size="15">
										<a4j:support event="onchange"></a4j:support>
										<rich:ajaxValidator 
		                    			event="onblur"
		                    			onsubmit="validateDecimalField(
		                    				fieldObject = this, 
		                    				fieldMsgId = 'saleDetPriceMsg', 
		                    				required = 'true', 
		                    				requiredMsg = 'Favor ingrese el Precio',
		                    				checkForZero = 'true',
		                    				errorClass = 'msgErrorDet',
		                    				errorInput = 'inputErrorDet')">
		           						</rich:ajaxValidator>
									</h:inputText>
									</a4j:outputPanel>
									<div id="saleDetPriceMsg" class="inactiveMsg"></div>
								</rich:column>
								<rich:column>
									<h:inputText value="#{trnSale.salesDet.discount}"
										id="saleDetDiscount" 
										size="10">
										<a4j:support event="onchange"></a4j:support>
										<rich:ajaxValidator 
		                    			event="onblur"
		                    			onsubmit="validateDecimalField(
		                    				fieldObject = this, 
		                    				fieldMsgId = 'saleDetDiscountMsg', 
		                    				required = 'false', 
		                    				requiredMsg = 'Favor ingrese el descuento',
		                    				checkForZero = 'negative',
		                    				errorClass = 'msgErrorDet',
		                    				errorInput = 'inputErrorDet')">
		           						</rich:ajaxValidator>
									</h:inputText>
									<div id="saleDetDiscountMsg" class="inactiveMsg"></div>
								</rich:column>
								<rich:column>
									<h:inputText value="#{trnSale.salesDet.charge}"
										id="saleDetCharge"
										size="10">
										<a4j:support event="onchange"></a4j:support>
										<rich:ajaxValidator 
		                    			event="onblur"
		                    			onsubmit="validateDecimalField(
		                    				fieldObject = this, 
		                    				fieldMsgId = 'saleDetChargeMsg', 
		                    				required = 'false', 
		                    				requiredMsg = 'Favor ingrese el recargo',
		                    				checkForZero = 'negative',
		                    				errorClass = 'msgErrorDet',
		                    				errorInput = 'inputErrorDet')">
		           						</rich:ajaxValidator>
									</h:inputText>
									<div id="saleDetChargeMsg" class="inactiveMsg"></div>
								</rich:column>
							</rich:columnGroup>
						</f:facet>
						<rich:column>
							<h:selectBooleanCheckbox value="#{row.selected}" />
						</rich:column>
						<rich:column rendered="#{not empty trnSale.allSalesDet}">
							<h:outputText value="#{row.supplyData.descrip}" />
						</rich:column>
						<rich:column rendered="#{not empty trnSale.allSalesDet}">
							<h:outputText value="#{row.measureUnitData.descrip}" />
						</rich:column>
						<rich:column rendered="#{not empty trnSale.allSalesDet}">
							<h:outputText value="#{row.taxData.descrip}" />
						</rich:column>
						<rich:column rendered="#{not empty trnSale.allSalesDet}">
							<h:outputText value="#{row.quantity}"/>
						</rich:column>
						<rich:column rendered="#{not empty trnSale.allSalesDet}">
							<h:outputText value="#{row.basicPrice}" />
						</rich:column>
						<rich:column rendered="#{not empty trnSale.allSalesDet}">
							<h:outputText value="#{row.discount}" />
						</rich:column>
						<rich:column rendered="#{not empty trnSale.allSalesDet}">
							<h:outputText value="#{row.charge}" />
						</rich:column>
						<rich:column rendered="#{not empty trnSale.allSalesDet}">
							<h:outputText value="#{row.itemAmount}" />
						</rich:column>
					</rich:dataTable>
				</rich:panel>
					<div class="total_values">
						<div class="total_values_fields">
							<s:label for="saleHeadTotal" style="float:left; float:left; margin-right:10px; top:3px;">
								<h:outputText value="Total Venta"/>
							</s:label>
							<h:inputText value="#{trnSale.salesHead.total}"
								id="saleHeadTotal" required="false" size="10"
								disabled="true">
							<a4j:support event="onchange"></a4j:support>
							</h:inputText>
							<div class="msg_container">
								<rich:message for="saleHeadTotal" />
							</div>
						</div>
						<div class="total_values_fields">
							<s:label for="saleHeadExempt" style="float:left; float:left; margin-right:10px; top:3px;">
								<h:outputText value="Total Exentas"/>
							</s:label>
							<h:inputText value="#{trnSale.salesHead.exemptTotal}"
								id="saleHeadExempt" required="false" size="10"
								disabled="true">
							<a4j:support event="onchange"></a4j:support>
							</h:inputText>
							<div class="msg_container">
								<rich:message for="saleHeadExempt" />
							</div>
						</div>
						<div class="total_values_fields">
							<s:label for="saleHeadTax" style="float:left; float:left; margin-right:10px; top:3px;">
								<h:outputText value="Total IVA"/>
							</s:label>
							<h:inputText value="#{trnSale.salesHead.taxTotal}"
								id="saleHeadTax" required="false" size="10"
								disabled="true">
							<a4j:support event="onchange"></a4j:support>
							</h:inputText>
							<div class="msg_container">
								<rich:message for="saleHeadTax" />
							</div>
						</div>
					</div>
				</a4j:outputPanel>
			</a4j:region>
			<s:decorate template="/layout/displayButton.xhtml" styleClass="button_form" style="width:198px;">
				<a4j:commandButton value="Guardar" id="saveRegBtn"
					action="#{trnSale.saveNewData()}"
					reRender="BuyForm"
					styleClass="button"
					onclick="onRequestStart();"
					oncomplete="onRequestEnd('j_id740:BuyForm', 15, #{trnSale.validateEntireForm});"
					/>
				<rich:spacer width="10px" />
				<a4j:commandButton value="Cancelar" id="cancelBtn"
					onclick="#{rich:component('SaleConfirmationModalPanel')}.show()"
					styleClass="button" />
			</s:decorate>
			
			<a4j:commandLink
					id="saleCloseBtn"
					styleClass="button"
					onclick="#{rich:component('SaleCloseModalPanel')}.show()" 
					style="position:relative; float:right; right:15px; margin-top:15px;">
					<h:graphicImage value="/img/icons/close.png"/>
			</a4j:commandLink>
		</a4j:form>
		
		
		<rich:modalPanel  id="SaleConfirmationModalPanel"
			resizeable="false" 
			autosized="true" 
			moveable="false" 
			style="border:2px solid #6FADDF">
			<a4j:form>
			<div class="globalMessage">
				<h:outputText value="Esta seguro que desea cancelar la operacion?" />
			</div>
			<s:decorate template="/layout/displayButton.xhtml" styleClass="trn_button_form"  style="width:270px; margin-top:0px; margin-left:auto; text-align:center;">
				<a4j:commandButton
					action="#{trnSale.cancelData()}"
					value="Aceptar" 
					id="SaleAcceptConfirmation"
					reRender="BuyForm"
					oncomplete="#{rich:component('SaleConfirmationModalPanel')}.hide()"
					styleClass="button"/>
				<rich:spacer width="20px" />
				<a4j:commandButton value="Cancelar" id="SaleCancelConfirmation"
					onclick="#{rich:component('SaleConfirmationModalPanel')}.hide()"
					styleClass="button" />
			</s:decorate>
			</a4j:form>
		</rich:modalPanel>
		
		<rich:modalPanel  id="SaleCloseModalPanel"
			resizeable="false" 
			autosized="true" 
			moveable="false"
			style="border:2px solid #6FADDF;">
			<a4j:form>
			<div class="globalMessage">
				<h:outputText value="Esta seguro que desea cancelar la operacion?"/>
			</div>
			<center>
			<s:decorate template="/layout/displayButton.xhtml" styleClass="trn_button_form"  style="width:270px; margin-top:0px; margin-left:auto; text-align:center;">
				<a4j:commandButton
					action="#{trnSale.cancelData()}"
					value="Aceptar" 
					id="SaleAcceptClose"
					reRender="BuyForm"
					oncomplete="#{rich:component('SaleCloseModalPanel')}.hide();#{rich:component('modalBuy')}.hide();"
					styleClass="button"/>
				<rich:spacer width="20px" />
				<a4j:commandButton value="Cancelar" id="SaleCancelClose"
					onclick="#{rich:component('SaleCloseModalPanel')}.hide()"
					styleClass="button" />
			</s:decorate>
			</center>
			</a4j:form>
		</rich:modalPanel>
		
		<rich:modalPanel
			id="customerPickModalPanel"
			width="420"
			height="320"
			resizeable="false">
			<f:facet name="header">
				<h:panelGroup>
					<h:outputText value="Proveedor" />
				</h:panelGroup>
			</f:facet>
			<f:facet name="controls">
				<h:panelGroup>
					<h:graphicImage value="/img/close.png" style="cursor:pointer"
						id="customerPickModalPanelHide">
					</h:graphicImage>
					<rich:componentControl for="customerPickModalPanel"
						attachTo="customerPickModalPanelHide" operation="hide" event="onclick" />
				</h:panelGroup>
			</f:facet>
			<h:panelGroup id="customerPickModalPanelEdit">
			<!--  **** Include of the update page ****  -->
				<a4j:include viewId="/fms/ven/transactions/venCustomerList.xhtml" />
			</h:panelGroup>
			<s:decorate template="/layout/displayButton.xhtml" styleClass="button_form" style="width:270px;">
				<a4j:form>
				<a4j:commandButton value="Aceptar" id="acceptSelectedCustomer"
					action="#{trnSale.selectCustomer(trnSale.selectHolder.customerPickData)}"
					reRender="BuyForm, saleHeadCustomer"
					styleClass="button"
					oncomplete="if(#{empty facesContext.maximumSeverity}) #{rich:component('customerPickModalPanel')}.hide();"/>
				<rich:spacer width="20px" />
				<a4j:commandButton value="Cancelar" id="cancelBtn"
					styleClass="button" />
				</a4j:form>
			</s:decorate>
		</rich:modalPanel>

</ui:composition>
